package com.demo.mapper;

import com.demo.entity.Flower;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface FlowerMapper {
    //查全部
    @Select("select * from flowers")
    List<Flower> selectAll();
    //姓名
    @Select("select * from flowers where flowerName like '%${studentName}%'")
    List<Flower> selectByname(String name);
    //id查
    @Select("select * from flowers where flowerId = #{id} ")
    Flower selectById(int id);
    //id删
    @Delete("delete from flowers where flowerId =#{id}")
    int deleteById(int id);
    //添加
    @Insert("insert into flowers (flowerName,category,price) values (#{flowerName},#{category},#{price})")
    int insertFlower(Flower flowers);
    //修改
    @Update("update flowers set flowerName=#{flowerName},category=#{category},price=#{price} where flowerId=#{flowerId}")
    int updateFlower(Flower flowers);
}
